package cn.wang.cart.config;

import cn.wang.cart.interceptor.CartInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

// 对mvc进行配置
@Configuration
public class LeyouConfiguration implements WebMvcConfigurer {

    @Autowired
    private CartInterceptor cartInterceptor;


    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 添加过滤器, 配置拦截路径为所有
        registry.addInterceptor(cartInterceptor).addPathPatterns("/**");
    }


}
